// MainPara.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include<iostream.h>
#include<stdlib.h> 
#include<string.h>
void main(int argc,char* argv[])
{
	char opr,str[81];
	double result,first,second;

	if(argc!=4)
	{
		cout<<"\nUsage:number1 operator number2\n";
		exit(0);
	}

   cout<<"Argc="<<argc<<endl; 
   cout<<"Argv[0]:"<<argv[0]<<endl;
   cout<<"Argv[1]:"<<argv[1]<<endl;
   cout<<"Argv[2]:"<<argv[2]<<endl;
   cout<<"Argv[3]:"<<argv[3]<<endl; 
	

   cout<<"Exp: "<<argv[1]<<argv[2]<<argv[3]<<endl;   
   first=atof(argv[1]);
   second=atof(argv[3]);
   strcpy(str,argv[2]);
   opr=str[0];
   
   switch(opr)
   {  case '+':  result=first+second;break;
      case '-':   result=first-second;break;
      case '*':   result=first*second;break;
      case '/':   if(second!=0)
				  { result=first/second;
                     break;
				  }
	  default: cout<<"\nError number(s) or operator.\n";
               exit(0);
   }
   cout<<"Result:"<<result<<endl;
}


